package com.otto.reggie.common;

/**
 * 基于ThreadLocal封装工具类
 * 作者：otto
 * 时间：2022-08-11 18:31:34
 */
public class BaseContext {
    private static ThreadLocal threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     *
     * @param id
     */
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 获取值
     *
     * @return
     */
    public static Long getCurrentId() {
        return (Long) threadLocal.get();
    }
}
